home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / text / tex / tex3141source.lha / tex.h < prev   
C/C++ Source or Header  |  1993-02-26  |  4KB  |  117 lines

  1. /*
  2.  * Main include file for TeX in C.
  3.  * You shouldn't have to change anything in this file except the initial
  4.  * #define's/#undef's, and the default search paths.
  5.  *
  6.  * Tim Morgan   December 23, 1987
  7.  */
  8.  
  9. #include <stdio.h>
  10. #include "site.h"
  11.  
  12. /* These are used in the change files and in macros defined in tex.h */
  13. #define    inputpathspec    1
  14. #define    readpathspec    2
  15. #define    fontpathspec    3
  16. #define    fmtpathspec    4
  17. #define    poolpathspec    5
  18.  
  19. /*
  20.  * If we're running on an ASCII system, there is no need to use the
  21.  * xchr[] array to convert characters to the external encoding.
  22.  */
  23. #ifdef    NONASCII
  24. #define    Xchr(x)        xchr[x]
  25. #else
  26. #define    Xchr(x)        ((char) (x))
  27. #endif
  28.  
  29. #ifndef    BSD
  30. #include <string.h>
  31. #else
  32. #include <strings.h>
  33. #endif
  34.  
  35. /*
  36.  * Some types we'll need.
  37.  */
  38. typedef FILE    *alphafile, *bytefile, *wordfile, *file_ptr;
  39. typedef char    *ccharpointer;
  40.  
  41. /*
  42.  * Global routines implemented as macros, plus some type coercion stuff.
  43.  */
  44.  
  45. /* This is a workaround to a casting bug in the Sequent Dynix 2.1 C compiler */
  46. #ifndef    sequent
  47. #define    toint(x)    ((integer) (x))
  48. #else
  49. #define    toint(x)    ztoint((integer)(x))
  50. extern integer    ztoint();
  51. #endif
  52.  
  53. /*
  54.  * Next, efficiency for Unix systems: use write() instead of stdio
  55.  * to write to the dvi file.
  56.  */
  57. #ifndef    unix
  58. #define    writedvi(a,b)    (void) fwrite((char *) &dvibuf[a], sizeof(dvibuf[a]), (int)(b-a+1), dvifile)
  59. #define    dumpcore()    exit(1)
  60. #else    /* unix */
  61. #define    writedvi(a,b)    (void) write(fileno(dvifile), (char *) &dvibuf[a], (int)(b-a+1))
  62. #define    dumpcore    abort
  63. #endif    /* unix */
  64.  
  65. #define readln(f)    {register c; while ((c=getc(f))!='\n' && c!=EOF); }
  66. #define    abs(x)        ((x>=0)?(x):(-(x)))
  67. #define    fabs(x)        ((x>=0.0)?(x):(-(x)))
  68. #define    Fputs(stream, s)    (void) fputs(s, stream)
  69. #define    vstrcpy(a,b)        (void) strcpy((a), (b))
  70. #define    inputln(stream, flag)    zinputln(stream)
  71. char zinputln();    /* Get function return type correct=>boolean */
  72. #define    dumpthings(base,len)    (void) fwrite((char *) &(base), sizeof(base), (int)(len), fmtfile)
  73. #define    undumpthings(base,len)    (void) fread((char *) &(base), sizeof(base), (int)(len), fmtfile)
  74. #define    termflush(t)    (void) fflush(t)
  75. #define    eof        feof
  76. #define    incr(x)        ++(x)
  77. #define    decr(x)        --(x)
  78. #define    uexit(x)    exit((int) (x))
  79. #define    odd(x)        ((x) % 2)
  80. #define    aopenin(f, p)    Openin(&(f), p)
  81. #define    bopenin(f)    Openin(&(f), fontpathspec) /* Only used for TFMs */
  82. #define    wopenin(f)    Openin(&(f), fmtpathspec)  /* Only used for FMTs */
  83. #define    aopenout(f)    Openout(&(f)) /* Always open outputs in cwd */
  84. #define    bopenout(f)    Openout(&(f))
  85. #define    wopenout(f)    Openout(&(f))
  86. #define    aclose(f)    if (f) (void) fclose(f)
  87. #define    bclose(f)    if (f) (void) fclose(f)
  88. #define    wclose(f)    if (f) (void) fclose(f)
  89. #define    read(f, c)    (c = getc(f))
  90. #define    true        1
  91. #define    false        0
  92. #define    chr(x)        (x)
  93. #define    round(x)    toint(x + 0.5)
  94. #define    dateandtime(i,j,k,l)    get_date_and_time(&(i), &(j), &(k), &(l))
  95.  
  96. #ifndef    SIXTEENBIT
  97. #define    putfmtint(x)    (void) putw((int)(x), fmtfile)
  98. #define    getfmtint(x)    x=getw(fmtfile)
  99. #else /* ! SIXTEENBIT */
  100. #define    putfmtint(x)    {integer x_val=(x); (void) fwrite((char *)&x_val,\
  101.                 sizeof(x_val), 1, fmtfile);}
  102. #define    getfmtint(x)    fread((char *) &x, sizeof(x), 1, fmtfile)
  103. #endif /* SIXTEENBIT */
  104.  
  105. #define    genericputfmt(x)(void) fwrite((char *) &(x), sizeof(x), 1, fmtfile)
  106. #define    genericgetfmt(x)(void) fread((char *) &(x), sizeof(x), 1, fmtfile)
  107. #define putfmtword    genericputfmt
  108. #define getfmtword    genericgetfmt
  109. #define putfmthh    genericputfmt
  110. #define getfmthh    genericgetfmt
  111. #define putfmtqqqq       genericputfmt
  112. #define    getfmtqqqq    genericgetfmt
  113.  
  114. #define    amakenamestring(f)    makenamestring()
  115. #define    bmakenamestring(f)    makenamestring()
  116. #define    wmakenamestring(f)    makenamestring()
  117.